<!--
 * @Author: your name
 * @Date: 2021-09-25 20:48:06
 * @LastEditTime: 2021-09-25 21:20:43
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue_test\src\App.vue
-->
<template>
  <div>
    <h1 v-text="msg" ref="title"></h1>
    <button ref="btn" @click="showDOM">点我输出上方的DOM元素</button>
    <School id="sch"></School>
  </div>
</template>

<script>
//引入School组件
import School from "./components/School";

export default {
  name: "App",
  components: { School },
  data() {
    return {
      msg: "欢迎学习Vue！",
    };
  },
  methods: {
    showDOM() {
      console.log(this.$refs.title);  //真实DOM元素
      console.log(this.$refs.btn);  //真实DOM元素
      console.log(this.$refs.sch);  //School组件的实例对象（vc）
    },
  },
};
</script>
